package pri.hillchen.std.concurrent.chapter6;

import java.util.Timer;
import java.util.TimerTask;

/**
 * Created by hillchen on 2018/2/8.
 */
public class OutOfTime {
    public static void main(String[] args) throws InterruptedException {
        Timer timer = new Timer();
        timer.schedule(new ThrowTask(),1);
        Thread.sleep(1000);
        timer.schedule(new ThrowTask(),1);
        Thread.sleep(5000);
    }
    static class ThrowTask extends TimerTask{
        public void run() {
            throw new RuntimeException("throw task !");
        }
    }
}
